package com.tuoren.forward.config;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.tuoren.forward.mapper.PermissionMapper;
import com.tuoren.forward.mapper.RoleMapper;

import cn.dev33.satoken.stp.StpInterface;

@Component   
public class StpInterfaceImpl implements StpInterface {

	
	@Autowired
	private PermissionMapper permissionMapper;
	
	@Autowired
	private RoleMapper roleMapper;
	
    /**
     * 返回一个账号所拥有的权限码集合 
     */
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        // 本list仅做模拟，实际项目中要根据具体业务逻辑来查询权限
    	List<String> list = permissionMapper.selectUrlByUserId((String)loginId);
        return list;
    }

    /**
     * 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验)
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        // 本list仅做模拟，实际项目中要根据具体业务逻辑来查询角色
    	List<String> list = roleMapper.selectIdByUserId((String)loginId);
        return list;
    }
}
